package com.zkx.mvp.itemtouch;

import android.support.v7.widget.helper.YolandaItemTouchHelper;

/**
 * Author：zhangkx on 2017/6/29 16:17
 * Email：zkx9025@163.com
 * item 侧滑
 */

public class MyItemSlideTouchHelper extends YolandaItemTouchHelper {
    private MyItemTouchHelperCallback itemTouchHelpCallback;

    public MyItemSlideTouchHelper(MyItemTouchHelperCallback.OnItemTouchCallbackListener onItemTouchCallbackListener) {
        super(new MyItemTouchHelperCallback(onItemTouchCallbackListener));
        itemTouchHelpCallback = (MyItemTouchHelperCallback) getCallback();
    }

    /**
     * 设置是否可以被拖拽
     *
     * @param canDrag 是true，否false
     */
    public void setDragEnable(boolean canDrag) {
        itemTouchHelpCallback.setDragEnable(canDrag);
    }

    /**
     * 设置是否可以被滑动
     *
     * @param canSwipe 是true，否false
     */
    public void setSwipeEnable(boolean canSwipe) {
        itemTouchHelpCallback.setSwipeEnable(canSwipe);
    }

}
